WIP: Port dmd and druntime to GNU/Hurd#22829
Conversation
|
Thanks for your pull request and interest in making D better, @yelninei! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#22829" |
|
The error from the circleci is I guess this is expected, is there a way to regenerate the header? |
|
Re: regenerating the headers, if you read a few more lines down in that error message, you will see this:
Which refers to https://github.com/dlang/dmd/tree/master/compiler/src#cxx-headers-test |
I thought dmd triplet (tuples?) matched ldc. Historically, I guess gnu/hurd would be |
|
Does hurd need fixups for entries in the dl phdr? Some other archs/platforms do. |
|
FAOD, there is no GC involved in the dso registry/section support code. v-- DSO loaded
#15 0x000000000000765e in call_init () from /gnu/store/cgjm6xbk68rpnl6gl326vfw5alg8ip9i-glibc-2.41/lib/ld-x86-64.so.1
v-- CRT in the DSO
#14 0x000000000b8c6182 in gdc.dso_ctor () at /tmp/guix-build-gdc-14.3.0.drv-0/build/x86_64-unknown-gnu/libphobos/src/<no_file>:1
v-- Register self into D runtime, find dl_phdr_info
#13 0x000000000bb033a5 in _d_dso_registry (data=data@entry=0x1e5eb30) at ../../../../gcc-14.3.0/libphobos/libdruntime/gcc/sections/elf.d:466
v-- Scans the found dl_phdr (.dynamic section, string table)
#12 0x000000000bb02b8e in gcc.sections.elf.getDependencies(ref const(core.sys.hurd.link.dl_phdr_info), ref core.internal.container.array.Array!(gcc.sections.elf.DSO*).Array) (info=..., deps=...) at ../../../../gcc-14.3.0/libphobos/libdruntime/gcc/sections/elf.d:806
v-- Get handle of library ref found in .dynamic
handle name is computed from phdr_info strtab + dyn val
#11 0x000000000bb0113b in gcc.sections.elf.handleForName(const(char*)) (name=<optimized out>)
at ../../../../gcc-14.3.0/libphobos/libdruntime/gcc/sections/elf.d:826
v-- Open handle to name at strtab + dyn val.
#10 0x000000000bfa5291 in dlopen@@GLIBC_2.38 () from /gnu/store/cgjm6xbk68rpnl6gl326vfw5alg8ip9i-glibc-2.41/lib/libc.so.0.3
v-- The rest just looks like dlopen failed because library not found
the computed name is a pointer to garbage.
#9 0x000000000bfa4d77 in _dlerror_run () from /gnu/store/cgjm6xbk68rpnl6gl326vfw5alg8ip9i-glibc-2.41/lib/libc.so.0.3
#8 0x00000000000045bf in _dl_catch_error () from /gnu/store/cgjm6xbk68rpnl6gl326vfw5alg8ip9i-glibc-2.41/lib/ld-x86-64.so.1
...
#1 0x000000000000ee25 in dl_open_worker_begin () from /gnu/store/cgjm6xbk68rpnl6gl326vfw5alg8ip9i-glibc-2.41/lib/ld-x86-64.so.1
#0 0x000000000002996f in strchr () from /gnu/store/cgjm6xbk68rpnl6gl326vfw5alg8ip9i-glibc-2.41/lib/ld-x86-64.so.1Most likely cause is the computed name being wrong: |
|
I think i found the issue. in dmd i set In my gdc Give me a few hours to rebuild and verify. my machine is currently busy rebuilding llvm to set the correct default target. |
That would certainly make the program segfault if you got that wrong. |
|
That fixed gdc. Sorry for the noise. |
|
Fixed termios constants. I als owent through all constants again to find bad copy pastes (i wish this would be less manual). I think this is now ready so I am removing the WIP part. THere are still some smaller issues in some tests but these can be fixed as well. for gdc I put the extra changes there already and it works well for my gdc-14 backport. I have also been working on making ldc work as well which only needs some minimal additional changes to let it know of the new target and overcoming issues with llvm itself. |
|
Whats the difference between target.h and frontend.h wrt the Target enum. ldc seems to use a variable from target.h which is not updated with the new Os. |
|
|
Thanks I added the new enum member there as well then. |
thewilsonator
left a comment
There was a problem hiding this comment.
Please squash all the druntime commits together and all of the DMD commits together.
004c5cb to
01b4f6d
Compare
|
@thewilsonator I needed the commit of druntime without the alias change to make backporting to gdc-11 a bit easier. I need this to be able to bootstrap without an initial cross compiler. In gdc-11 this is a lot more of a mess because druntime used CRuntime_Glibc for linux+glibc and naively following the |
|
Noted, do what you need to do. Can you squash the last two commits together? Also do you plan on adding CI for Hurd? |
Note tat a few tests still fail, either because it is not supported in libc (e.g. The best experience is with debian/hurd but I dont know if there is a convenient way to set that up with github actions. You'd still need to get an initial D compiler from somewhere, I am not sure how D is bootstrapped in debian. |
|
I have resolved a merge conflict in x86/cod1.d |
|
I had another look at some of the failing tests is failing This comes from a pragma in the non I found I thing id need to enable |
Hi,
As announced on https://forum.dlang.org/thread/agrrykgbdsjlbsgjtatq@forum.dlang.org here is my WIP PR for porting druntime and dmd to GNU Hurd.
To be able to build also #22787 is needed.
Things that I know are still a bit of a mess:
version(linux)whereCRuntime_Glibcis used to mean linux + glibc.I am currently quite happy with the dmd part as all tests pass on 32bit and 64bit except
For the runtime some tests still crash in pthread_join, I am not entirely sure why as the same test outside of libdruntime_ut works fine.
On x86_64 the test runner gets killed after a while with the gc suspend signal, I dont know yet why the runtime does not handle it.
I am not erntirely sure about the format for the dmd triplet as it differs from both the gnu config and llvm triplet.
I have asked people on the bug-hurd mailing list for help as well
https://lists.gnu.org/archive/html/bug-hurd/2026-03/msg00274.html
https://lists.gnu.org/archive/html/bug-hurd/2026-03/msg00275.html
There are some more things needed to bring this back into gdc,